home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutord.EXE
/
STRUC2.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-16
|
587b
|
34 lines
/* struc2.c */
struct T2 { char *s; int i; struct T2 *at; };
main()
{
int i;
static struct T2 abc;
static struct T2 a[] = {
"abcd", 100, &a[1],
"efgh", 101, &a[2],
"xyz", 102, &a[0],
"xxx", 103, &a[4],
"aex", 103, &abc
};
printf("%s\n",a[1].at->s);
printf("%s\n",a[1].s);
printf("%d\n",a[1].i);
i=replace(a[3].at->at, a[0].at->at);
printf("%s\n",abc.s);
printf("%d\n",abc.i);
printf("%d\n",abc.at->i);
}
replace(p1,p2)
struct T2 *p1, *p2;
{
int i;
p1->at = p2->at;
p1->s = p2->at->s;
p1->i = p2->i;
return(p1->at->i);
}